<header>
    <h1>Magasin {$data.name}</h1>
</header>

<ul id="magNote">
    <li><h2>Ville : {$data.ville.2}</h2></li>
    <li>
        <strong>Propreté</strong>
        <div class="jRating1" data="{$data.note1}_{$data._id}"></div>
    </li>
    <li>
        <strong>Accueil</strong>
        <div class="jRating2" data="{$data.note2}_{$data._id}"></div>
    </li>
    <li>
        <strong>Accessibilité</strong>
        <div class="jRating3" data="{$data.note3}_{$data._id}"></div>
    </li>
</ul>

{if $data.lat == '0'}
Aucune donnée GPS disponible pour la localisation.
{else}
    <div id="maps" class="singleMap">
    </div>
   {strip}
    <script type="text/javascript">
    {literal}
    var GoogleMap = {
        zoom: 12,
        id: 'maps',
        markers :
        [
            { latitude: {/literal}{$data.lat}{literal},
              longitude: {/literal}{$data.lng}{literal},
              html: {/literal}"{$data.name}"{literal},
              icon: {
                    image: "{/literal}{$SYS_FOLDER}{literal}themes/macrise/images/gmap_pin.png",
                    iconsize: [26, 46],
                    iconanchor: [12,46],
                    infowindowanchor: [12, 0]
                }
            }
            {/literal}
                { foreach from=$chasseurs item=chasseur }
                    {literal},{
                        latitude: {/literal}{$chasseur.lat}{literal},
                        longitude: {/literal}{$chasseur.lng},{literal}
                        html: "Chasseur {/literal}{$chasseur.prenom}{literal}",
                        icon: {
                            image: "{/literal}{$SYS_FOLDER}{literal}themes/macrise/images/gmap_pin_orange.png",
                            iconsize: [26, 46],
                            iconanchor: [12,46],
                            infowindowanchor: [12, 0]
                        }
                        }
                    {/literal}
                {/foreach}
            {literal}
        ]
    }
    {/literal}
    </script>
    {/strip}
{/if}

<section class="commentaires">
    <header>
        <h1>Commentaires</h1>
    </header>

    <ul>
        { if $coms }
        { foreach from=$coms item=com }
        <li class="commentaire">
            <span class="date">{ $com.date_create|date_format:"%d/%m/%Y" }</span>
            
            <span class="message">
                <span class="user">{ $com.user->prenom } { $com.user->nom }</span>
                { $com.message }
            </span>
        </li>
        { /foreach }
        { else }
        <li class="commentaire">
            <span class="message">Aucun commentaire pour le moment...</span>
        </li>
        { /if }
        
        { if $user_connected }
        <li class="commentaire">
            <form method="post" action="{ $HTTP_HOST_REQUEST }">
                <input type="hidden" name="todo" value="Commentaire" />
                <input type="hidden" name="object_id" value="{ $data._id }" />

                <span class="date">
                    <button type="submit">
                        <img src="{ $BASE_URL }themes/macrise/images/plus.png" width="32" height="32" alt="Ajouter" />
                    </button>
                </span>

                <span class="message">
                    <textarea name="message" placeholder="Votre message"></textarea>
                </span>
            </form>
        </li>
        { /if }
    </ul>
</section>